<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/base/jsp/include.jsp"%>
<style>
</style>
<script type="text/javascript">
	var id = "${code}";
	var submitForm = function($dialog, $grid, $pjq) {
		if ($('form').form('validate')) {
			var url = sy.contextPath + '/chatDept/save.do';
			var obj = sy.serializeObject($('form'));
			$.post(url,obj , function(result) {
				if (result.code == 0) {
					$grid.datagrid('reload');
					$dialog.dialog('destroy');
				} else {
					$pjq.messager.e('操作失败，'+result.msg);
				}
			}, 'json');
		}
	};

	$(function() {
		// 初始化取色器
		$('.color').val("#000000");
		$('.color').colorPicker({opacity:false});
		
		if (id != '') {
			$('.account').remove();
			$.post(sy.contextPath + '/chatDept/findById', {
				code : id
			}, function(result) {
				if (result) {
					$('form').form('load', result);
					$('.color').val(result.style);
					$('.color').colorPicker({opacity:false});
				}
			}, 'json');
			$('#name').textbox('readonly');
			$('#name').textbox('disableValidation');
		}
	});
</script>
</head>
<body>
	<form id="form" method="post">
        <input name="code" type="hidden" />
        <div style="padding:15px;font-size: 12px">
            <table style="table-layout:fixed;" border="0" cellspacing="0" class="formtable">
            	<tr>
                    <th style="width:100px;">名称：</th>
                    <td>
                    	 <input id="name" name="name" class="easyui-textbox" data-options="required:true,validType:['length[1,12]','unique[\'/chatDept/isNameExist\']']" missingMessage="请输入部门/街道名称" style="width: 90%;" prompt="请输入部门/街道名称"/>
                    </td>
                </tr>
                <tr>
                    <th style="width:100px;">排序：</th>
                    <td>
                    	 <input id="sortOrder" name="sortOrder" class="easyui-numberbox" data-options="required:true,min:1,max:999" missingMessage="请输入排序" style="width: 90%;" prompt="请输入排序"/>
                    	 <div>
                    	 	<span style="color: red;" id="labelStar">*</span>
                  		 	<span id="labelText" style="font-size:12px;">按正序排序</span>
                    	 </div>
                    </td>
                </tr>
                <tr>
                	<th style="width:100px;">色值</th>
                    <td>
                    	<input id="color" type="text" name="style" class="color"/>
                    </td>
                </tr>
                <tr class='account'>
                	<th style="width:100px;">账号</th>
                    <td>
                    	<input id="account" type="text" name="account" class="easyui-textbox" data-options="required:true,validType:['unique[\'/chatDept/isAccountExist\']']"/>
                    </td>
                </tr>
                <tr class='account'>
                	<th style="width:100px;">密码</th>
                    <td>
                    	<input id="password" type="password" name="password" class="easyui-textbox" data-options="required:true"/>
                    </td>
                </tr>
            </table>
        </div>
	</form>
</body>
</html>